﻿using System.Web.UI;
using Microsoft.SharePoint;

namespace Eneta.Portal.Controls
{
    public class EnetaBreadcrumbControl : UserControl
    {
        protected override void Render(HtmlTextWriter writer)
        {
            base.Render(writer);

            var parent = SPContext.Current.Web;

            writer.Write("<ul><li>");
            writer.Write(parent.Title);
            writer.Write("</li>");            

            while((parent = parent.ParentWeb) != null)
            {
                writer.Write("<li>");
                writer.Write(parent.Title);
                writer.Write("</li>");            
            }

            writer.Write("");
        }
    }
}
